/**
 * Created by gykj.
 */
import Axios from 'axios'


Axios.defaults.withCredentials = false;

const axios = Axios.create();




export const POST = (url, params) => {
  return axios.post(`${url}`, params).then(res => res.data)
};

export const GET = (url, params) => {
  return axios.get(`${url}`, {
    params: params
  }).then(res => res.data)
};

export const POSTBLOB = (url, params) => {
  return axios({
    method:'post',
    url:`${url}`,
    data:params,
    responseType:'blob'
  }).then(res => res.data)
};
export const POSTBLOBOri = (url, params) => {
  return axios({
    method:'post',
    url:`${url}`,
    data:params,
    responseType:'blob'
  }).then(res => res)
};
export const GETBLOB = (url, params) => {
  return axios.get(`${url}`, {
    params: params,
    responseType:'blob'
  }).then(res => res.data)
};

export const GETBLOBORI = (url, params) => {
  return axios.get(`${url}`, {
    params: params,
    responseType:'blob'
  }).then(res => res)
};



export const GET2 = (url, params) => {
  return axios.get(`${url}`, {
    params: params
  }).then(res => res.data)
};

export const PUT = (url, params) => {
  return axios.put(`${url}`, params).then(res => res.data)
};

export const DELETE = (url, params) => {
  return axios.delete(`${url}`, {
    params: params
  }).then(res => res.data)
};

export const PATCH = (url, params) => {
  return axios.patch(`${url}`, params).then(res => res.data)
};

// 通过表单提交
export const POST_FORM_DATA = (url, data) => {
  return axios({
    method: "post",
    url: `${url}`,
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    }
  }).then(res => res.data);
};
